﻿<!DOCTYPE html>
<html>
<head>
    <link rel="shortcut icon" href="../../static/images/favicon.ico"/>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>数据列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" type="text/css" href="../../static/bootstrap-3.3.7/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../static/bootstrap-3.3.7/css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/bootstrap-3.3.7/css/bootstrap-slider.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../static/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../../static/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="../../static/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../static/css/sxl/dataList.css"/>

    <script type="text/javascript" src="../../static/js/jquery-2.1.3.min.js"></script>
    <script type="text/javascript" src="../../static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../static/js/zrender.js"></script>


    <script type="text/javascript" src="../../static/layer/layer.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/bootstrap.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/moment-with-locales.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/bootstrap-slider.min.js"></script>
    <script type="text/javascript" src="../../static/bootstrap-3.3.7/js/BootstrapMenu.min.js"></script>
    <script type="text/javascript" src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
    <script type="text/javascript" src="../../static/js/utils/CommonUtils.js"></script>
    <script type="text/javascript" src="../../static/js/utils/Base64Utils.js"></script>
    <script src="../../static/js/sxl/dataList.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
    $(function () {
        //url请求参数集合
        window.RequestUrl = getUrlRequest();
        //日期控件的设置------------------
        $('#datetimepickerstart').datetimepicker({
            language: 'zh-CN',//显示中文
            format: 'yyyy-mm-dd hh:ii:ss',//显示格式
            initialDate: new Date(),
            autoclose: true,//选中自动关闭
            todayBtn: true,//显示今日按钮
            locale: moment.locale('zh-cn')
        });
        $('#datetimepickerend').datetimepicker({
            language: 'zh-CN',//显示中文
            format: 'yyyy-mm-dd hh:ii:ss',//显示格式
            initialDate: new Date(),
            autoclose: true,//选中自动关闭
            todayBtn: true,//显示今日按钮
            locale: moment.locale('zh-cn')
        });
        //获取页面的显示方式（以普通方式显示或以组件方式显示）
        //注意：js中使用el表达式一定要用引号引起来
        var tassemblyType="${param.tassemblyType}";
        //写死的
       var primarykey = '2019-04-28 16:12:001';//primarykey
        //写死的
        var labcode = 'Haierrefrigerator20151214';//实验室编码
      /* var primarykey = $.cookie("nowprimarykey");
       var labcode = $.cookie("labcode");*/

        /*if(tassemblyType=="tassembly"){ //组件方式请求
            primarykey="${param.primarykey}";
            labcode= "${param.labcode}";
        }else{      //非组件方式请求
            if((primarykey==""||primarykey== undefined)){
                primarykey=$.cookie('primarykey');
            }
            if((labcode==""||labcode==undefined)){
                labcode= $.cookie('labcode');
            }
        }*/

        //设置开始时间为第一条数据的时间,即primarykey
        var starttime = primarykey.substring(0,primarykey.length-1);
        if(!isDateTime(starttime)){
            starttime=starttime.splice(10," ");
        }
        var endtime = new Date().Format("yyyy-MM-dd hh:mm:ss");
        //开始时间
        $("#startdate").val(starttime);
        //结束时间
        $("#enddate").val(endtime);
        //日期控件的设置------------------

        var testunitno = RequestUrl["testunitno"];//台位号
        if(testunitno==""||testunitno==undefined){
            testunitno=primarykey.substring(primarykey.length-1);
        }
        //获取所有选择的传感器名称
        getAllSelectSensorName(primarykey, testunitno);

        //获取数据列表(默认查询第一页)
        getDataList(labcode, testunitno, 1,null,null);

        // 首页、上一页、下一页、末页查询,查询按钮点击事件
        $(".skip").click(function () {
            //获取当前点击事件的id
            var id=$(this).attr("id");
            //获取当前页数
            var pageNum = $("#pageNum").text(); //当前的页数
            var pages = $("#pages").text(); //末尾的页数

//表格初始化
            /*$("#table_content").dataTable({
                "lengthMenu":[5,10,15,20,25]
            })*/

            //获取点击的按钮
            if (this.id == "search") {  //查询
                pageNum = 0;
            } else if (this.id == "first") {   //首页
                pageNum = 1;
            } else if (this.id == "previous") {   //上一页
                pageNum = Number(pageNum) - 1;
            } else if (this.id == "next") {      //下一页
                pageNum = Number(pageNum) + 1;
            } else if (this.id == "last") {     //末页
                pageNum = pages;
            } else if (this.id == "sure") {
                pageNum = $("#tiaozhuan").val();
                if (pageNum == '') {
                    sweetAlert("警告", "请输入页码！", "warning");
                    return false;
                }
            }
            if (pageNum <= 0) {
                return;
            }
            //获取开始时间
            let startdate=$("#startdate").val();
            //获取结束时间
            let enddate=$("#enddate").val();
            //校验日期格式
            if(!isDateTime(startdate)||!isDateTime(enddate)){
                sweetAlert("警告", "日期格式不正确！", "error");
                return false;
            }
            //根据页码获取数据列表
            getDataList(labcode, testunitno, pageNum,startdate,enddate);
        });
    })
</script>

<body class="table-responsive">
<div class="searchInfo">
    <div class="startTime">
        <label>开始时间</label>
        <a class='input-group date' id='datetimepickerstart'>
        <input type='text' class="form-control" id='startdate'/>
        <span class="input-group-addon startdateinput" >
            <span class="glyphicon glyphicon-calendar"></span>
        </span>
        </a>
    </div>

    <div class="endTime">
        <label>结束时间</label>
        <a class='input-group date' id='datetimepickerend'>
        <input type='text' class="form-control" id='enddate'/>
        <span class="input-group-addon enddateinput" >
         <span class="glyphicon glyphicon-calendar"></span>
        </span>
        </a>
    </div>

    <button id="query" class="btn btn-info querybutton skip" >查询</button>
    <button id="query" class="btn btn-info querybutton skip" >导出</button>
</div>


<div style="overflow-x: scroll;border: 1px solid #b6b6b6;">
    <table class="table table-hover" id="table_content">
    </table>
</div>
<div style="float: left;margin-top: 10px">
    <input type="radio" name="refresh" value="1"/><label>停止刷新</label>
    <input type="radio" name="refresh" value="0" style="margin-left: 30px"/><label>实时刷新</label>
</div>

<div class="bottomPage">
    总共<span id="total">10</span>条记录
    <input id="first" class="btn btn-info skip" value="首页"/>
    <input id="previous" class="btn btn-info skip" value="上一页"/>
    <span id="pageNum">1</span>/<span id="pages">1</span>页
    <input id="next" class="btn btn-info skip" value="下一页"/>
    <input id="last" class="btn btn-info skip" value="尾页"/>
    跳转到<input type="text" id="tiaozhuan" style="width: 40px;"/>页
    <input class="btn btn-info skip" value="跳转" id="sure"/>
</div>


</body>
</html>
